var gotoSearch,showCarInfo;
require([], function () {
    var $formData = $('#formData');

    function carChange(event, treeId, treeNode) {
        if (treeNode.type === 'CAR') {
            searchCarInfo(treeNode.id);
        } else {
            $.messager.alert("提示", "请选择一辆车进行查看。");
        }
    }

    //左侧树
    commonFun.leftTreeNodeClickObj['carAnaCarInfo'] = carChange;

    function searchCarInfo(carId) {
        $.ajaxExt({
            url: "/carAna/getCarInfoByCarId.htm",
            data: {'carId': carId}
        }).done(function (data) {
            $formData.setViewData(data);
            $("#organName_eqmt").html(data.organName);
            $.ajaxExt({
                url: "/carAna/getCarDrvRel.htm",
                data: {'carId': carId}
            }).done(function (data) {
                var drvLi = "";
                $(data).each(function (i, item) {
                    drvLi += '<li><label class="label-text">驾驶员名称：</label><span class="span-text">' + item.drvName + '</span></li>';
                });
                $("#drvName").html(drvLi);
            });
        });
    }

    gotoSearch = function (carId) {
        commonFun.setSelectedNodes(carId);
        searchCarInfo(carId);
    };
    
    showCarInfo = function(data){
    	gotoSearch(data.carId)
    }

    business.execFnByLeftTreeSelectNode('CAR', carChange);

});